class TaskScheduler:
    def generate_task_annotate(params: dict):
        """
        根据触发器类型和参数生成装饰器表达式字符串
        :param params: 触发器的参数（字典形式）
        :return: 装饰器表达式字符串
        """
        # 构建参数部分
        params_list = []
        trigger=params.get("trigger_type")
        #根据类型进行判断赋值 trigger=interval  / cron /date
        if trigger == "interval":
            for key, value in params.items():
                if key == 'seconds' and value != '0':
                    params_list.append(f"{key}={value}")
                if key == 'minutes' and value != '0':
                    params_list.append(f"{key}={value}")
                if key == 'hours' and value != '0':
                    params_list.append(f"{key}={value}")
                if key == 'days' and value != '0':
                    params_list.append(f"{key}={value}")
                if key == 'weeks' and value != '0':
                    params_list.append(f"{key}={value}")
                if key == 'start_date' and value is not None:
                    params_list.append(f"{key}='{value}'")
                if key == 'end_date' and value is not None:
                    params_list.append(f"{key}='{value}'")
        elif trigger == "cron":
            for key, value in params.items():
                if key == 'year' and value != '*' and value != '0':
                    params_list.append(f"{key}={value}")
                if key == 'month' and value != '*' and value != '0':
                    params_list.append(f"{key}={value}")
                if key == 'day' and value != '*' and value != '0':
                    params_list.append(f"{key}={value}")
                if key == 'week' and value != '*' and value != '0':
                    params_list.append(f"{key}={value}")
                if key == 'day_of_week' and value is not None:
                    params_list.append(f"{key}='{value}'")
                if key == 'hour' and value != '*' and value != '0':
                    params_list.append(f"{key}={value}")
                if key == 'minute' and value != '*' and value != '0':
                    params_list.append(f"{key}={value}")
                if key == 'second' and value != '*' and value != '0':
                    params_list.append(f"{key}={value}")
                if key == 'start_date' and value is not None:
                    params_list.append(f"{key}='{value}'")
                if key == 'end_date' and value is not None:
                    params_list.append(f"{key}='{value}'")
        elif trigger == "date":
            for key, value in params.items():
                if key == 'run_date' and value is not None:
                    params_list.append(f"{key}={value}")

        # 构建装饰器表达式
        annotate_info = f"@scheduler.task(trigger='{trigger}', {', '.join(params_list)})"
        return annotate_info
